INSTRUCTIONS TO GENERATE THE TABLES AND FIGURES IN THE RESULTS SECTION

SECTION 1�3

Run replication.R
(Note that parts of the script will produce warning messages. This is expected and not a bug.)

1. Frequency tables

Table 4a: EDcompFreexpTables.csv
Table 4b: EDcompAltInfTables.csv
Table 4c: FreeexpAltinfTable.csv

2. Transition graphs

Left panels of Figure 2:
EDcompFreexp.tif
EDcompAltinf.tif
FreexpAltinf.tif

Right panels of Figure 2:
Fetch data from these files:
   FreexpAltinfResults.csv
   EDcompAltinfResults.csv
   EDcompFreexpResults.csv
Paste data (note that there are columne headings - these should now be copied to the Excel sheet) into the worksheets named Data in these files:
   FreexpAltinfOE.xlsx
   EDcompAltInfOE.xlsx
   EDcompFreexpOE.xlsx
Graphs are on worksheet For graph

3. Dependency tables

Table 5:
From the files
   Contingencies.xlsx (numbers not in parentheses)
   Contingencies0.xlsx (numbers in parentheses)
First two columns in the three first work sheets are the two rows in each table

Table 6:
The file Contingencies + calculations.xlsx shows how to calculate the table from the numbers in the file Contingencies.xlsx. Note that the calculations do not start until the worksheet v2x_suffr5C and following worksheets.

SECTION 4

First, you need to have run replication.R, as the next script (dynsys.R) depends on it.
Run dynsys.R
Note that you have to uncomment (remove #) before "output..." and "write..." in the script to produce the results required. These are commented at present because each run takes about an hour, so you may want to run just a partial selection of the code at a time.

4. Bayesian dynamical systems

Figure 3:
bdynsys2_v2x_freexp_v2xme_altinf.eps

Figure 4:
bdynsys2_v2x_freexp_v2x_EDcomp_thick.eps

**********

Equations (not necessary to generate figures and tables):
In order to generate the equation system in the manuscript, and those used to determine the arrows in Figures 3�4, the commented lines in dynsys.R need to be uncommented. Generating these systems takes several hours. The output is written to a file, and the procedure to locate the right equations in this file is to find the largest Bayes factors for dx and dy (and dz where applicable) at the bottom of the text (note that since they are negative, removing the minus sign, the largest number is then the smallest). If the largest Bayes factor for dx is the k-th one, then locate Model # 1 of size k, with dx on the left-hand side of the equality. This gives the equation for dx (using different variable names than in the manuscript: y[1] for x, y[2] for y, and y[3] for z). Repeat for dy (and dz where applicable).

Equation system in the manuscript:
bdynsys_freexp_altinf_EDcomp.txt

Equations used for generating Figure 3:
bdynsys2_freexp_altinf.txt

Equations used for generating Figure 4:
bdynsys2_freexp_EDcomp.txt
